package com.jier.common.message;

import com.google.gson.Gson;
import com.google.gson.GsonBuilder;
import org.springframework.http.converter.json.GsonHttpMessageConverter;
import springfox.documentation.spring.web.json.Json;

/**
 * Created by kalen on 16/8/29.
 */
public class CustomGsonConverter extends GsonHttpMessageConverter {
    public CustomGsonConverter() {
        //更换Gson转换器
        GsonBuilder builder = new GsonBuilder();
        builder.setDateFormat("yyyy-MM-dd HH:mm:ss");
        builder.registerTypeAdapter(Json.class, new SpringfoxJsonToGsonAdapter());
        Gson gson = builder.create();
        super.setGson(gson);
    }
}
